package router

import (
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
	"mxshop-api/user-web/api"
	"mxshop-api/user-web/middlewares"
)

// 初始化用户路由
func InitUserRouter(Router *gin.RouterGroup) {
	UserRouter := Router.Group("user")
	zap.S().Infof("配置用户相关的url")
	{
		UserRouter.GET("/user_test", api.UserTest)
		//获取用户列表 //先判断权限，后判断是不是管理员
		UserRouter.GET("", middlewares.JWTAuth(), middlewares.IsAdminAuth(), api.GetUserList)
		//登录
		UserRouter.POST("/pwd_login", api.PassWordLogin)
		//用户注册
		UserRouter.POST("register", api.RegisterUser)
		//获取用户详情
		UserRouter.GET("detail", middlewares.JWTAuth(), api.GetUserDetail)
		//更新用户
		UserRouter.POST("update", middlewares.JWTAuth(), api.UpdateUser)
	}
}
